
import os
import time
from configs.config import MODEL_PATH


class Config:
    nb_classes = 17
    max_sequence_length = 30
    nb_words = 10000
    embedding_dim = 100
    bidirectional = True
    num_lstm = 150
    num_dense = 100
    rate_drop_lstm = 0.15
    rate_drop_dense = 0.15
    epochs = 10000
    batch_size = 2000
    shuffle = True
    act = 'sigmoid'
    re_weight = True  # whether to re-weight classes to fit the 17.5% share in test set
    tensorboard_update_freq = 1000

    # time_str = time.strftime("%Y-%m-%d-%H-%M-%S", time.localtime())
    # model_path = os.path.join(MODEL_PATH, 'weights/identification/train_+调差消材对应物料训练样本/' + time_str)
    # if not os.path.exists(model_path):
    #     os.makedirs(model_path)
    model_path = os.path.join(MODEL_PATH, 'weights/identification/lstm')
    model_file = os.path.join(model_path, 'model.h5')
    tokenizer_path = os.path.join(model_path, 'tokenizer.pkl')

    @classmethod
    def __repr__(cls):
        return {
            "nb_classes":cls.nb_classes,
            "max_sequence_length": cls.max_sequence_length,
            "nb_words": cls.nb_words,
            "embedding_dim": cls.embedding_dim,
            "bidirectional":cls.bidirectional,
            "num_lstm": cls.num_lstm,
            "rate_drop_lstm": cls.rate_drop_lstm,
            "num_dense": cls.num_dense,
            "rate_drop_lstm": cls.rate_drop_lstm,
            "rate_drop_dense":cls.rate_drop_dense,
            "epochs":cls.epochs,
            "batch_size": cls.batch_size,
            "shuffle": cls.shuffle,
            "act": cls.act,
            "tensorboard_update_freq":cls.tensorboard_update_freq,
            "re_weight": cls.re_weight,
            "model_path": cls.model_path,
            "model_file": cls.model_file,
            "tokenizer_path": cls.tokenizer_path,
        }